/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  
  checkConfig(config);
  @endpoint = getEndpoint('cgcs', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model BatchCheckSessionRequest {
  records?: [ 
    {
      customSessionId?: string(name='CustomSessionId'),
      platformSessionId?: string(name='PlatformSessionId'),
      referenceInfo?: map[string]any(name='ReferenceInfo'),
      type?: string(name='Type', description='This parameter is required.'),
    }
  ](name='Records', description='This parameter is required.'),
}

model BatchCheckSessionShrinkRequest {
  recordsShrink?: string(name='Records', description='This parameter is required.'),
}

model BatchCheckSessionResponseBody = {
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
}

model BatchCheckSessionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: BatchCheckSessionResponseBody(name='body'),
}

/**
 * @summary 批量检查异常会话
 *
 * @param tmpReq BatchCheckSessionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return BatchCheckSessionResponse
 */
async function batchCheckSessionWithOptions(tmpReq: BatchCheckSessionRequest, runtime: Util.RuntimeOptions): BatchCheckSessionResponse {
  Util.validateModel(tmpReq);
  var request = new BatchCheckSessionShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.records)) {
    request.recordsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.records, 'Records', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.recordsShrink)) {
    query['Records'] = request.recordsShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'BatchCheckSession',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 批量检查异常会话
 *
 * @param request BatchCheckSessionRequest
 * @return BatchCheckSessionResponse
 */
async function batchCheckSession(request: BatchCheckSessionRequest): BatchCheckSessionResponse {
  var runtime = new Util.RuntimeOptions{};
  return batchCheckSessionWithOptions(request, runtime);
}

model CancelReserveTaskRequest {
  clientToken?: string(name='ClientToken', example='2YEF0****'),
  taskId?: string(name='TaskId', description='This parameter is required.', example='b354****'),
}

model CancelReserveTaskResponseBody = {
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
  taskId?: string(name='TaskId', example='b354****'),
}

model CancelReserveTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CancelReserveTaskResponseBody(name='body'),
}

/**
 * @summary 取消 session 资源预定任务
 *
 * @param request CancelReserveTaskRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CancelReserveTaskResponse
 */
async function cancelReserveTaskWithOptions(request: CancelReserveTaskRequest, runtime: Util.RuntimeOptions): CancelReserveTaskResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.taskId)) {
    body['TaskId'] = request.taskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CancelReserveTask',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 取消 session 资源预定任务
 *
 * @param request CancelReserveTaskRequest
 * @return CancelReserveTaskResponse
 */
async function cancelReserveTask(request: CancelReserveTaskRequest): CancelReserveTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  return cancelReserveTaskWithOptions(request, runtime);
}

model CreateAdaptationRequest {
  adaptTarget?: {
    bitRate?: int32(name='BitRate', example='30'),
    frameRate?: int32(name='FrameRate', example='30'),
    resolution?: string(name='Resolution', example='1080p'),
    startProgram?: string(name='StartProgram', example='/example/example.exe'),
  }(name='AdaptTarget'),
  appVersionId?: string(name='AppVersionId', description='This parameter is required.', example='1432****'),
}

model CreateAdaptationShrinkRequest {
  adaptTargetShrink?: string(name='AdaptTarget'),
  appVersionId?: string(name='AppVersionId', description='This parameter is required.', example='1432****'),
}

model CreateAdaptationResponseBody = {
  adaptApplyId?: long(name='AdaptApplyId', example='5435****'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
}

model CreateAdaptationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateAdaptationResponseBody(name='body'),
}

/**
 * @summary 提交适配请求
 *
 * @param tmpReq CreateAdaptationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateAdaptationResponse
 */
async function createAdaptationWithOptions(tmpReq: CreateAdaptationRequest, runtime: Util.RuntimeOptions): CreateAdaptationResponse {
  Util.validateModel(tmpReq);
  var request = new CreateAdaptationShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.adaptTarget)) {
    request.adaptTargetShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.adaptTarget, 'AdaptTarget', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.adaptTargetShrink)) {
    body['AdaptTarget'] = request.adaptTargetShrink;
  }
  if (!Util.isUnset(request.appVersionId)) {
    body['AppVersionId'] = request.appVersionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateAdaptation',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 提交适配请求
 *
 * @param request CreateAdaptationRequest
 * @return CreateAdaptationResponse
 */
async function createAdaptation(request: CreateAdaptationRequest): CreateAdaptationResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAdaptationWithOptions(request, runtime);
}

model CreateAppRequest {
  appName?: string(name='AppName', description='This parameter is required.', example='example'),
  appType?: string(name='AppType', description='This parameter is required.', example='end_game'),
  streamingAppId?: string(name='StreamingAppId', example='47d0bd4d-8815-48a2-b783-6cbba89d****'),
  streamingSolution?: string(name='StreamingSolution', example='self-have-streaming'),
}

model CreateAppResponseBody = {
  appId?: string(name='AppId', example='4384****'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
}

model CreateAppResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateAppResponseBody(name='body'),
}

/**
 * @summary 应用创建服务
 *
 * @param request CreateAppRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateAppResponse
 */
async function createAppWithOptions(request: CreateAppRequest, runtime: Util.RuntimeOptions): CreateAppResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appName)) {
    body['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.appType)) {
    body['AppType'] = request.appType;
  }
  if (!Util.isUnset(request.streamingAppId)) {
    body['StreamingAppId'] = request.streamingAppId;
  }
  if (!Util.isUnset(request.streamingSolution)) {
    body['StreamingSolution'] = request.streamingSolution;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateApp',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 应用创建服务
 *
 * @param request CreateAppRequest
 * @return CreateAppResponse
 */
async function createApp(request: CreateAppRequest): CreateAppResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAppWithOptions(request, runtime);
}

model CreateAppSessionRequest {
  adapterFileId?: string(name='AdapterFileId', description='适配文件ID。此功能灰度开放，如未约定使用请勿传入。', example='501716211209548966XXXX'),
  appId?: string(name='AppId', description='This parameter is required.', example='13027XXXX'),
  appVersion?: string(name='AppVersion', example='35067XXXX'),
  clientIp?: string(name='ClientIp', example='192.168.XXX.XXX'),
  customSessionId?: string(name='CustomSessionId', description='This parameter is required.', example='1ADE0XXXX'),
  customUserId?: string(name='CustomUserId', example='2YEF0XXXX'),
  districtId?: string(name='DistrictId', example='huadong'),
  enablePostpaid?: boolean(name='EnablePostpaid', example='false'),
  projectId?: string(name='ProjectId', description='项目ID。如果已将应用关联到项目，创建会话时需填写正确的项目ID。', example='d9a8****'),
  startParameters?: [ 
    {
      key?: string(name='Key', example='startArgument'),
      value?: string(name='Value', example='exampleValue'),
    }
  ](name='StartParameters'),
  systemInfo?: [ 
    {
      key?: string(name='Key', example='utdid'),
      value?: string(name='Value', example='OE0usD+APXXXX'),
    }
  ](name='SystemInfo'),
  timeout?: long(name='Timeout', example='1800'),
}

model CreateAppSessionResponseBody = {
  appId?: string(name='AppId', example='13027XXXX'),
  appVersion?: string(name='AppVersion', example='35067XXXX'),
  customSessionId?: string(name='CustomSessionId', example='1ADE0XXXX'),
  platformSessionId?: string(name='PlatformSessionId', example='100XXXX'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
}

model CreateAppSessionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateAppSessionResponseBody(name='body'),
}

/**
 * @summary 增加实时生产资源的相关字段
 *
 * @param request CreateAppSessionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateAppSessionResponse
 */
async function createAppSessionWithOptions(request: CreateAppSessionRequest, runtime: Util.RuntimeOptions): CreateAppSessionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.adapterFileId)) {
    query['AdapterFileId'] = request.adapterFileId;
  }
  if (!Util.isUnset(request.appId)) {
    query['AppId'] = request.appId;
  }
  if (!Util.isUnset(request.appVersion)) {
    query['AppVersion'] = request.appVersion;
  }
  if (!Util.isUnset(request.clientIp)) {
    query['ClientIp'] = request.clientIp;
  }
  if (!Util.isUnset(request.customSessionId)) {
    query['CustomSessionId'] = request.customSessionId;
  }
  if (!Util.isUnset(request.customUserId)) {
    query['CustomUserId'] = request.customUserId;
  }
  if (!Util.isUnset(request.districtId)) {
    query['DistrictId'] = request.districtId;
  }
  if (!Util.isUnset(request.enablePostpaid)) {
    query['EnablePostpaid'] = request.enablePostpaid;
  }
  if (!Util.isUnset(request.projectId)) {
    query['ProjectId'] = request.projectId;
  }
  if (!Util.isUnset(request.startParameters)) {
    query['StartParameters'] = request.startParameters;
  }
  if (!Util.isUnset(request.systemInfo)) {
    query['SystemInfo'] = request.systemInfo;
  }
  if (!Util.isUnset(request.timeout)) {
    query['Timeout'] = request.timeout;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateAppSession',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 增加实时生产资源的相关字段
 *
 * @param request CreateAppSessionRequest
 * @return CreateAppSessionResponse
 */
async function createAppSession(request: CreateAppSessionRequest): CreateAppSessionResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAppSessionWithOptions(request, runtime);
}

model CreateAppSessionBatchRequest {
  appInfos?: [ 
    {
      adapterFileId?: string(name='AdapterFileId'),
      appId?: string(name='AppId', description='This parameter is required.'),
      appVersion?: string(name='AppVersion'),
      clientIp?: string(name='ClientIp'),
      customUserId?: string(name='CustomUserId'),
      customerSessionId?: string(name='CustomerSessionId', description='This parameter is required.', nullable=false),
      datasetId?: string(name='DatasetId'),
      districtId?: string(name='DistrictId'),
      projectId?: string(name='ProjectId'),
      resultStore?: {
        need?: boolean(name='Need'),
        storeInfo?: [ 
          {
            key?: string(name='Key'),
            value?: string(name='Value'),
          }
        ](name='StoreInfo'),
        type?: string(name='Type'),
      }(name='ResultStore'),
      startParameters?: [ 
        {
          key?: string(name='Key'),
          value?: string(name='Value'),
        }
      ](name='StartParameters'),
      systemInfo?: [ 
        {
          key?: string(name='Key'),
          value?: string(name='Value'),
        }
      ](name='SystemInfo'),
    }
  ](name='AppInfos', description='This parameter is required.'),
  customTaskId?: string(name='CustomTaskId', description='This parameter is required.'),
  timeout?: int32(name='Timeout', description='This parameter is required.'),
}

model CreateAppSessionBatchShrinkRequest {
  appInfosShrink?: string(name='AppInfos', description='This parameter is required.'),
  customTaskId?: string(name='CustomTaskId', description='This parameter is required.'),
  timeout?: int32(name='Timeout', description='This parameter is required.'),
}

model CreateAppSessionBatchResponseBody = {
  customTaskId?: string(name='CustomTaskId'),
  platformTaskId?: string(name='PlatformTaskId'),
  requestId?: string(name='RequestId'),
}

model CreateAppSessionBatchResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateAppSessionBatchResponseBody(name='body'),
}

/**
 * @summary 批量创建会话
 *
 * @param tmpReq CreateAppSessionBatchRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateAppSessionBatchResponse
 */
async function createAppSessionBatchWithOptions(tmpReq: CreateAppSessionBatchRequest, runtime: Util.RuntimeOptions): CreateAppSessionBatchResponse {
  Util.validateModel(tmpReq);
  var request = new CreateAppSessionBatchShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.appInfos)) {
    request.appInfosShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.appInfos, 'AppInfos', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appInfosShrink)) {
    query['AppInfos'] = request.appInfosShrink;
  }
  if (!Util.isUnset(request.customTaskId)) {
    query['CustomTaskId'] = request.customTaskId;
  }
  if (!Util.isUnset(request.timeout)) {
    query['Timeout'] = request.timeout;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateAppSessionBatch',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 批量创建会话
 *
 * @param request CreateAppSessionBatchRequest
 * @return CreateAppSessionBatchResponse
 */
async function createAppSessionBatch(request: CreateAppSessionBatchRequest): CreateAppSessionBatchResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAppSessionBatchWithOptions(request, runtime);
}

model CreateAppSessionBatchSyncRequest {
  appInfos?: [ 
    {
      adapterFileId?: string(name='AdapterFileId', example='501716211209548966XXXX'),
      appId?: string(name='AppId', description='This parameter is required.', example='13027****'),
      appVersion?: string(name='AppVersion', example='35067****'),
      clientIp?: string(name='ClientIp', example='192.168.XX.XX'),
      customUserId?: string(name='CustomUserId', example='2YEF0****'),
      customerSessionId?: string(name='CustomerSessionId', description='This parameter is required.', example='1ADE0****', nullable=false),
      districtId?: string(name='DistrictId', example='huadong'),
      matchRules?: [ 
        {
          key?: string(name='Key', example='component'),
          type?: string(name='Type', example='in'),
          values?: [ string ](name='Values'),
        }
      ](name='MatchRules'),
      projectId?: string(name='ProjectId', example='d9a8****'),
      startParameters?: [ 
        {
          key?: string(name='Key', example='startArgument'),
          value?: string(name='Value', example='exampleValue'),
        }
      ](name='StartParameters'),
      systemInfo?: [ 
        {
          key?: string(name='Key', example='utdid'),
          value?: string(name='Value', example='OE0usD+AP****'),
        }
      ](name='SystemInfo'),
      tags?: [ 
        {
          key?: string(name='Key', example='exampleTag'),
          value?: string(name='Value', example='exampleValue'),
        }
      ](name='Tags'),
    }
  ](name='AppInfos', description='This parameter is required.'),
  batchId?: string(name='BatchId', description='This parameter is required.', example='6d4d****'),
}

model CreateAppSessionBatchSyncShrinkRequest {
  appInfosShrink?: string(name='AppInfos', description='This parameter is required.'),
  batchId?: string(name='BatchId', description='This parameter is required.', example='6d4d****'),
}

model CreateAppSessionBatchSyncResponseBody = {
  batchId?: string(name='BatchId', example='6d4d****'),
  failedList?: [ 
    {
      appId?: string(name='AppId', example='100****'),
      customSessionId?: string(name='CustomSessionId', example='1ADE0****'),
      failedInfo?: {
        errorCode?: string(name='ErrorCode', example='App type not support.'),
        errorMessage?: string(name='ErrorMessage', example='400'),
      }(name='FailedInfo'),
    }
  ](name='FailedList'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
  resultList?: [ 
    {
      appId?: string(name='AppId', example='13027****'),
      appVersion?: string(name='AppVersion', example='35067****'),
      bizInfo?: {
        biz?: map[string]any(name='Biz', example='authToken'),
        endpoints?: [ 
          {
            accessHost?: string(name='AccessHost', example='127.0.X.X'),
            accessPort?: string(name='AccessPort', example='8080'),
            districtId?: string(name='DistrictId', example='huadong'),
            isp?: string(name='Isp', example='bgp'),
            name?: string(name='Name', example='exampleName'),
            type?: string(name='Type', example='Native'),
          }
        ](name='Endpoints'),
      }(name='BizInfo'),
      customSessionId?: string(name='CustomSessionId', example='1ADE0****'),
      platformSessionId?: string(name='PlatformSessionId', example='100****'),
    }
  ](name='ResultList'),
}

model CreateAppSessionBatchSyncResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateAppSessionBatchSyncResponseBody(name='body'),
}

/**
 * @summary 同步批量创建多个会话
 *
 * @param tmpReq CreateAppSessionBatchSyncRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateAppSessionBatchSyncResponse
 */
async function createAppSessionBatchSyncWithOptions(tmpReq: CreateAppSessionBatchSyncRequest, runtime: Util.RuntimeOptions): CreateAppSessionBatchSyncResponse {
  Util.validateModel(tmpReq);
  var request = new CreateAppSessionBatchSyncShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.appInfos)) {
    request.appInfosShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.appInfos, 'AppInfos', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appInfosShrink)) {
    query['AppInfos'] = request.appInfosShrink;
  }
  if (!Util.isUnset(request.batchId)) {
    query['BatchId'] = request.batchId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateAppSessionBatchSync',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 同步批量创建多个会话
 *
 * @param request CreateAppSessionBatchSyncRequest
 * @return CreateAppSessionBatchSyncResponse
 */
async function createAppSessionBatchSync(request: CreateAppSessionBatchSyncRequest): CreateAppSessionBatchSyncResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAppSessionBatchSyncWithOptions(request, runtime);
}

model CreateAppSessionSyncRequest {
  adapterFileId?: string(name='AdapterFileId', example='501716211209548966XXXX'),
  appId?: string(name='AppId', description='This parameter is required.', example='13027****'),
  appVersion?: string(name='AppVersion', example='35067****'),
  clientIp?: string(name='ClientIp', example='192.168.XX.XX'),
  customSessionId?: string(name='CustomSessionId', description='This parameter is required.', example='1ADE0****'),
  customUserId?: string(name='CustomUserId', example='2YEF0****'),
  districtId?: string(name='DistrictId', example='huadong'),
  matchRules?: [ 
    {
      key?: string(name='Key', example='component'),
      type?: string(name='Type', example='in'),
      values?: [ string ](name='Values'),
    }
  ](name='MatchRules'),
  projectId?: string(name='ProjectId', example='d9a8****'),
  startParameters?: [ 
    {
      key?: string(name='Key', example='startArgument'),
      value?: string(name='Value', example='exampleValue'),
    }
  ](name='StartParameters'),
  systemInfo?: [ 
    {
      key?: string(name='Key', example='utdid'),
      value?: string(name='Value', example='OE0usD+AP****'),
    }
  ](name='SystemInfo'),
  tags?: [ 
    {
      key?: string(name='Key', example='exampleTag'),
      value?: string(name='Value', example='exampleValue'),
    }
  ](name='Tags'),
}

model CreateAppSessionSyncResponseBody = {
  appId?: string(name='AppId', example='13027****'),
  appVersion?: string(name='AppVersion', example='35067****'),
  bizInfo?: {
    biz?: map[string]any(name='Biz', example='authToken'),
    endpoints?: [ 
      {
        accessHost?: string(name='AccessHost', example='127.0.X.X'),
        accessPort?: string(name='AccessPort', example='8080'),
        districtId?: string(name='DistrictId', example='huabei'),
        isp?: string(name='Isp', example='BGP'),
        name?: string(name='Name', example='exampleName'),
        type?: string(name='Type', example='Native'),
      }
    ](name='Endpoints'),
  }(name='BizInfo'),
  customSessionId?: string(name='CustomSessionId', example='1ADE0****'),
  platformSessionId?: string(name='PlatformSessionId', example='100****'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
}

model CreateAppSessionSyncResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateAppSessionSyncResponseBody(name='body'),
}

/**
 * @summary 同步创建会话
 *
 * @param request CreateAppSessionSyncRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateAppSessionSyncResponse
 */
async function createAppSessionSyncWithOptions(request: CreateAppSessionSyncRequest, runtime: Util.RuntimeOptions): CreateAppSessionSyncResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.adapterFileId)) {
    query['AdapterFileId'] = request.adapterFileId;
  }
  if (!Util.isUnset(request.appId)) {
    query['AppId'] = request.appId;
  }
  if (!Util.isUnset(request.appVersion)) {
    query['AppVersion'] = request.appVersion;
  }
  if (!Util.isUnset(request.clientIp)) {
    query['ClientIp'] = request.clientIp;
  }
  if (!Util.isUnset(request.customSessionId)) {
    query['CustomSessionId'] = request.customSessionId;
  }
  if (!Util.isUnset(request.customUserId)) {
    query['CustomUserId'] = request.customUserId;
  }
  if (!Util.isUnset(request.districtId)) {
    query['DistrictId'] = request.districtId;
  }
  if (!Util.isUnset(request.matchRules)) {
    query['MatchRules'] = request.matchRules;
  }
  if (!Util.isUnset(request.projectId)) {
    query['ProjectId'] = request.projectId;
  }
  if (!Util.isUnset(request.startParameters)) {
    query['StartParameters'] = request.startParameters;
  }
  if (!Util.isUnset(request.systemInfo)) {
    query['SystemInfo'] = request.systemInfo;
  }
  if (!Util.isUnset(request.tags)) {
    query['Tags'] = request.tags;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateAppSessionSync',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 同步创建会话
 *
 * @param request CreateAppSessionSyncRequest
 * @return CreateAppSessionSyncResponse
 */
async function createAppSessionSync(request: CreateAppSessionSyncRequest): CreateAppSessionSyncResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAppSessionSyncWithOptions(request, runtime);
}

model CreateAppVersionRequest {
  appId?: string(name='AppId', description='This parameter is required.', example='4384****'),
  appVersionName?: string(name='AppVersionName', description='This parameter is required.', example='exampleVersion'),
}

model CreateAppVersionResponseBody = {
  appVersionId?: string(name='AppVersionId', example='1432****'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
}

model CreateAppVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateAppVersionResponseBody(name='body'),
}

/**
 * @summary 应用版本创建服务
 *
 * @param request CreateAppVersionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateAppVersionResponse
 */
async function createAppVersionWithOptions(request: CreateAppVersionRequest, runtime: Util.RuntimeOptions): CreateAppVersionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appId)) {
    body['AppId'] = request.appId;
  }
  if (!Util.isUnset(request.appVersionName)) {
    body['AppVersionName'] = request.appVersionName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateAppVersion',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 应用版本创建服务
 *
 * @param request CreateAppVersionRequest
 * @return CreateAppVersionResponse
 */
async function createAppVersion(request: CreateAppVersionRequest): CreateAppVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAppVersionWithOptions(request, runtime);
}

model CreateCapacityReservationRequest {
  appId?: string(name='AppId', description='This parameter is required.', example='13027****'),
  appVersion?: string(name='AppVersion', example='35067****'),
  clientToken?: string(name='ClientToken', example='2YEF0****'),
  districtId?: string(name='DistrictId', description='This parameter is required.', example='huadong'),
  expectResourceReadyTime?: string(name='ExpectResourceReadyTime', example='2022-02-02 22:22:22', deprecated=true),
  expectSessionCapacity?: int32(name='ExpectSessionCapacity', description='This parameter is required.', example='100'),
  projectId?: string(name='ProjectId', description='This parameter is required.', example='d9a8****'),
}

model CreateCapacityReservationResponseBody = {
  currMaxAllocatableSessionCapacity?: int32(name='CurrMaxAllocatableSessionCapacity', example='10000'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
  taskId?: string(name='TaskId', example='b354****'),
}

model CreateCapacityReservationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateCapacityReservationResponseBody(name='body'),
}

/**
 * @summary 预定session资源
 *
 * @param request CreateCapacityReservationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateCapacityReservationResponse
 */
async function createCapacityReservationWithOptions(request: CreateCapacityReservationRequest, runtime: Util.RuntimeOptions): CreateCapacityReservationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appId)) {
    body['AppId'] = request.appId;
  }
  if (!Util.isUnset(request.appVersion)) {
    body['AppVersion'] = request.appVersion;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.districtId)) {
    body['DistrictId'] = request.districtId;
  }
  if (!Util.isUnset(request.expectResourceReadyTime)) {
    body['ExpectResourceReadyTime'] = request.expectResourceReadyTime;
  }
  if (!Util.isUnset(request.expectSessionCapacity)) {
    body['ExpectSessionCapacity'] = request.expectSessionCapacity;
  }
  if (!Util.isUnset(request.projectId)) {
    body['ProjectId'] = request.projectId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateCapacityReservation',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 预定session资源
 *
 * @param request CreateCapacityReservationRequest
 * @return CreateCapacityReservationResponse
 */
async function createCapacityReservation(request: CreateCapacityReservationRequest): CreateCapacityReservationResponse {
  var runtime = new Util.RuntimeOptions{};
  return createCapacityReservationWithOptions(request, runtime);
}

model DeleteAppRequest {
  appId?: string(name='AppId', description='This parameter is required.', example='4384****'),
}

model DeleteAppResponseBody = {
  appId?: string(name='AppId', example='4384****'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
}

model DeleteAppResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteAppResponseBody(name='body'),
}

/**
 * @summary 应用删除接口
 *
 * @param request DeleteAppRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteAppResponse
 */
async function deleteAppWithOptions(request: DeleteAppRequest, runtime: Util.RuntimeOptions): DeleteAppResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appId)) {
    body['AppId'] = request.appId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteApp',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 应用删除接口
 *
 * @param request DeleteAppRequest
 * @return DeleteAppResponse
 */
async function deleteApp(request: DeleteAppRequest): DeleteAppResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteAppWithOptions(request, runtime);
}

model DeleteAppVersionRequest {
  appVersionId?: string(name='AppVersionId', description='This parameter is required.', example='1432****'),
}

model DeleteAppVersionResponseBody = {
  appVersionId?: string(name='AppVersionId', example='1432****'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
}

model DeleteAppVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteAppVersionResponseBody(name='body'),
}

/**
 * @summary 应用版本删除接口
 *
 * @param request DeleteAppVersionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteAppVersionResponse
 */
async function deleteAppVersionWithOptions(request: DeleteAppVersionRequest, runtime: Util.RuntimeOptions): DeleteAppVersionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appVersionId)) {
    body['AppVersionId'] = request.appVersionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteAppVersion',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 应用版本删除接口
 *
 * @param request DeleteAppVersionRequest
 * @return DeleteAppVersionResponse
 */
async function deleteAppVersion(request: DeleteAppVersionRequest): DeleteAppVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteAppVersionWithOptions(request, runtime);
}

model DescribeInstanceStatsInfoRequest {
  districtIds?: [ string ](name='DistrictIds'),
  instanceTypes?: [ string ](name='InstanceTypes'),
  projectIds?: [ string ](name='ProjectIds'),
}

model DescribeInstanceStatsInfoResponseBody = {
  data?: [ 
    {
      districtId?: string(name='DistrictId', example='huabei'),
      instanceType?: string(name='InstanceType', example='gcs.r1c1m1.1xlarge'),
      operatingInstanceCount?: int32(name='OperatingInstanceCount', example='1'),
      projectId?: string(name='ProjectId', example='6733705348307226241003'),
      releasingInstanceCount?: int32(name='ReleasingInstanceCount', example='1'),
      reservingInstanceCount?: int32(name='ReservingInstanceCount', example='1'),
      runningInstanceCount?: int32(name='RunningInstanceCount', example='1'),
      totalCount?: int32(name='TotalCount', example='4'),
    }
  ](name='Data'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0977'),
}

model DescribeInstanceStatsInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeInstanceStatsInfoResponseBody(name='body'),
}

/**
 * @param request DescribeInstanceStatsInfoRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeInstanceStatsInfoResponse
 */
async function describeInstanceStatsInfoWithOptions(request: DescribeInstanceStatsInfoRequest, runtime: Util.RuntimeOptions): DescribeInstanceStatsInfoResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeInstanceStatsInfo',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeInstanceStatsInfoRequest
 * @return DescribeInstanceStatsInfoResponse
 */
async function describeInstanceStatsInfo(request: DescribeInstanceStatsInfoRequest): DescribeInstanceStatsInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeInstanceStatsInfoWithOptions(request, runtime);
}

model GetAdaptationRequest {
  adaptApplyId?: long(name='AdaptApplyId', example='1432****'),
  appVersionId?: string(name='AppVersionId', example='5435****'),
}

model GetAdaptationResponseBody = {
  adaptApplyId?: long(name='AdaptApplyId', example='5435****'),
  adaptTarget?: {
    bitRate?: int32(name='BitRate', example='30'),
    frameRate?: int32(name='FrameRate', example='30'),
    resolution?: string(name='Resolution', example='1080p'),
    startProgram?: string(name='StartProgram', example='/example/example.exe'),
  }(name='AdaptTarget'),
  appId?: string(name='AppId', example='4384****'),
  appVersionId?: string(name='AppVersionId', example='1432****'),
  gmtCreate?: string(name='GmtCreate', example='2022-04-06 02:00:00'),
  gmtModified?: string(name='GmtModified', example='2022-04-06 02:00:00'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
}

model GetAdaptationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAdaptationResponseBody(name='body'),
}

/**
 * @summary 获取适配申请详情
 *
 * @param request GetAdaptationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAdaptationResponse
 */
async function getAdaptationWithOptions(request: GetAdaptationRequest, runtime: Util.RuntimeOptions): GetAdaptationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.adaptApplyId)) {
    body['AdaptApplyId'] = request.adaptApplyId;
  }
  if (!Util.isUnset(request.appVersionId)) {
    body['AppVersionId'] = request.appVersionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetAdaptation',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取适配申请详情
 *
 * @param request GetAdaptationRequest
 * @return GetAdaptationResponse
 */
async function getAdaptation(request: GetAdaptationRequest): GetAdaptationResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAdaptationWithOptions(request, runtime);
}

model GetAppRequest {
  appId?: string(name='AppId', description='This parameter is required.', example='4384****'),
}

model GetAppResponseBody = {
  appId?: string(name='AppId', example='4384****'),
  appName?: string(name='AppName', example='example'),
  appType?: string(name='AppType', example='end_game'),
  gmtCreate?: string(name='GmtCreate', example='2022-04-06 02:00:00'),
  gmtModified?: string(name='GmtModified', example='2022-04-06 02:00:00'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
  streamingAppId?: string(name='StreamingAppId', example='47d0bd4d-8815-48a2-b783-6cbba89d****'),
  streamingSolution?: string(name='StreamingSolution', example='self-have-streaming'),
  versionAdaptNum?: long(name='VersionAdaptNum', example='10'),
  versionTotalNum?: long(name='VersionTotalNum', example='28'),
}

model GetAppResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAppResponseBody(name='body'),
}

/**
 * @summary 应用详情接口
 *
 * @param request GetAppRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAppResponse
 */
async function getAppWithOptions(request: GetAppRequest, runtime: Util.RuntimeOptions): GetAppResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appId)) {
    body['AppId'] = request.appId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetApp',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 应用详情接口
 *
 * @param request GetAppRequest
 * @return GetAppResponse
 */
async function getApp(request: GetAppRequest): GetAppResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAppWithOptions(request, runtime);
}

model GetAppCcuRequest {
  appId?: string(name='AppId', example='13027****'),
  appVersion?: string(name='AppVersion', example='35067****'),
  projectId?: string(name='ProjectId', example='d9a8****'),
}

model GetAppCcuResponseBody = {
  detailList?: [ 
    {
      appId?: string(name='AppId', example='13027****'),
      appVersion?: string(name='AppVersion', example='35067****'),
      ccu?: string(name='Ccu', example='100'),
      districtId?: string(name='DistrictId', example='huadong'),
      projectId?: string(name='ProjectId', example='d9a8****'),
    }
  ](name='DetailList'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
  timestamp?: string(name='Timestamp'),
}

model GetAppCcuResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAppCcuResponseBody(name='body'),
}

/**
 * @summary 查询会话并发数
 *
 * @param request GetAppCcuRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAppCcuResponse
 */
async function getAppCcuWithOptions(request: GetAppCcuRequest, runtime: Util.RuntimeOptions): GetAppCcuResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetAppCcu',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询会话并发数
 *
 * @param request GetAppCcuRequest
 * @return GetAppCcuResponse
 */
async function getAppCcu(request: GetAppCcuRequest): GetAppCcuResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAppCcuWithOptions(request, runtime);
}

model GetAppSessionRequest {
  customSessionId?: string(name='CustomSessionId', example='1ADE0XXXX'),
  platformSessionId?: string(name='PlatformSessionId', example='100XXXX'),
}

model GetAppSessionResponseBody = {
  appId?: string(name='AppId', example='13027XXXX'),
  appVersion?: string(name='AppVersion', example='35067XXXX'),
  bizInfo?: {
    startTime?: string(name='StartTime', description='会话启动时间', example='2022-07-20 17:58:51'),
    stopTime?: string(name='StopTime', description='会话停止时间', example='2022-07-20 17:58:57'),
  }(name='BizInfo', description='业务特定的信息，如会话启动/停止时间。'),
  customSessionId?: string(name='CustomSessionId', example='1ADE0XXXX'),
  platformSessionId?: string(name='PlatformSessionId', example='100XXXX'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
  status?: string(name='Status', example='running'),
}

model GetAppSessionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAppSessionResponseBody(name='body'),
}

/**
 * @summary 获取App会话信息
 *
 * @param request GetAppSessionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAppSessionResponse
 */
async function getAppSessionWithOptions(request: GetAppSessionRequest, runtime: Util.RuntimeOptions): GetAppSessionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.customSessionId)) {
    query['CustomSessionId'] = request.customSessionId;
  }
  if (!Util.isUnset(request.platformSessionId)) {
    query['PlatformSessionId'] = request.platformSessionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetAppSession',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取App会话信息
 *
 * @param request GetAppSessionRequest
 * @return GetAppSessionResponse
 */
async function getAppSession(request: GetAppSessionRequest): GetAppSessionResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAppSessionWithOptions(request, runtime);
}

model GetAppVersionRequest {
  appVersionId?: string(name='AppVersionId', description='This parameter is required.', example='1432****'),
}

model GetAppVersionResponseBody = {
  appId?: string(name='AppId', example='4384****'),
  appVersionId?: string(name='AppVersionId', example='1432****'),
  appVersionName?: string(name='AppVersionName', example='exampleVersion'),
  appVersionStatus?: string(name='AppVersionStatus', example='file_uploading'),
  appVersionStatusMemo?: string(name='AppVersionStatusMemo'),
  consumeCu?: double(name='ConsumeCu', example='0.31'),
  fileAddress?: string(name='FileAddress', example='https://www.example.com/exampleFile.tar'),
  fileSize?: long(name='FileSize', example='1024'),
  fileUploadFinishTime?: string(name='FileUploadFinishTime', example='2022-04-06 02:00:00'),
  fileUploadType?: string(name='FileUploadType', example='local_file_upload'),
  gmtCreate?: string(name='GmtCreate', example='2022-04-06 02:00:00'),
  gmtModified?: string(name='GmtModified', example='2022-04-06 02:00:00'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
}

model GetAppVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAppVersionResponseBody(name='body'),
}

/**
 * @summary 应用版本详情接口
 *
 * @param request GetAppVersionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAppVersionResponse
 */
async function getAppVersionWithOptions(request: GetAppVersionRequest, runtime: Util.RuntimeOptions): GetAppVersionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appVersionId)) {
    body['AppVersionId'] = request.appVersionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetAppVersion',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 应用版本详情接口
 *
 * @param request GetAppVersionRequest
 * @return GetAppVersionResponse
 */
async function getAppVersion(request: GetAppVersionRequest): GetAppVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAppVersionWithOptions(request, runtime);
}

model GetCapacityRequest {
  appId?: string(name='AppId', example='13027****'),
  appVersion?: string(name='AppVersion', example='35067****'),
  districtId?: string(name='DistrictId', example='huadong'),
  pageNum?: int32(name='PageNum', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  projectId?: string(name='ProjectId', example='d9a8****'),
}

model GetCapacityResponseBody = {
  capacities?: [ 
    {
      appId?: string(name='AppId', example='13027****'),
      appVersion?: string(name='AppVersion', example='35067****'),
      districtId?: string(name='DistrictId', example='huadong'),
      projectId?: string(name='ProjectId', example='d9a8****'),
      sessionCapacity?: int32(name='SessionCapacity', example='2'),
    }
  ](name='Capacities'),
  pageNum?: int32(name='PageNum', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
  total?: int32(name='Total', example='100'),
}

model GetCapacityResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetCapacityResponseBody(name='body'),
}

/**
 * @summary 查询 session 会话容量信息
 *
 * @param request GetCapacityRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetCapacityResponse
 */
async function getCapacityWithOptions(request: GetCapacityRequest, runtime: Util.RuntimeOptions): GetCapacityResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appId)) {
    body['AppId'] = request.appId;
  }
  if (!Util.isUnset(request.appVersion)) {
    body['AppVersion'] = request.appVersion;
  }
  if (!Util.isUnset(request.districtId)) {
    body['DistrictId'] = request.districtId;
  }
  if (!Util.isUnset(request.pageNum)) {
    body['PageNum'] = request.pageNum;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.projectId)) {
    body['ProjectId'] = request.projectId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetCapacity',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询 session 会话容量信息
 *
 * @param request GetCapacityRequest
 * @return GetCapacityResponse
 */
async function getCapacity(request: GetCapacityRequest): GetCapacityResponse {
  var runtime = new Util.RuntimeOptions{};
  return getCapacityWithOptions(request, runtime);
}

model GetReserveTaskDetailRequest {
  taskId?: string(name='TaskId', description='This parameter is required.', example='b354****'),
}

model GetReserveTaskDetailResponseBody = {
  appId?: string(name='AppId', example='13027****'),
  appVersion?: string(name='AppVersion', example='35067****'),
  currCompletedSessionCapacity?: int32(name='CurrCompletedSessionCapacity', example='100'),
  districtId?: string(name='DistrictId', example='huadong'),
  expectResourceReadyTime?: string(name='ExpectResourceReadyTime', example='2022-02-02 22:22:22'),
  expectSessionCapacity?: int32(name='ExpectSessionCapacity', example='100'),
  projectId?: string(name='ProjectId', example='d9a8****'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
  resBatchList?: [ 
    {
      resBatchId?: string(name='ResBatchId', example='726573XXXX'),
      resBatchTagName?: string(name='ResBatchTagName', example='resBatchId'),
    }
  ](name='ResBatchList'),
  taskId?: string(name='TaskId', example='b354****'),
  taskStatus?: string(name='TaskStatus', example='created'),
}

model GetReserveTaskDetailResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetReserveTaskDetailResponseBody(name='body'),
}

/**
 * @summary 查询预定任务的详情信息
 *
 * @param request GetReserveTaskDetailRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetReserveTaskDetailResponse
 */
async function getReserveTaskDetailWithOptions(request: GetReserveTaskDetailRequest, runtime: Util.RuntimeOptions): GetReserveTaskDetailResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.taskId)) {
    body['TaskId'] = request.taskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetReserveTaskDetail',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询预定任务的详情信息
 *
 * @param request GetReserveTaskDetailRequest
 * @return GetReserveTaskDetailResponse
 */
async function getReserveTaskDetail(request: GetReserveTaskDetailRequest): GetReserveTaskDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  return getReserveTaskDetailWithOptions(request, runtime);
}

model GetResourcePublicIPsRequest {
  pageNum?: int32(name='PageNum', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  projectId?: string(name='ProjectId', example='d9a8****'),
}

model GetResourcePublicIPsResponseBody = {
  ipList?: [ 
    {
      ip?: string(name='Ip', example='127.0.X.X'),
      projectId?: string(name='ProjectId', example='d9a8****'),
    }
  ](name='IpList'),
  pageNum?: int32(name='PageNum', example='20'),
  pageSize?: int32(name='PageSize', example='1'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
  total?: int32(name='Total', example='100'),
}

model GetResourcePublicIPsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetResourcePublicIPsResponseBody(name='body'),
}

/**
 * @summary 查询公网ip
 *
 * @param request GetResourcePublicIPsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetResourcePublicIPsResponse
 */
async function getResourcePublicIPsWithOptions(request: GetResourcePublicIPsRequest, runtime: Util.RuntimeOptions): GetResourcePublicIPsResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.pageNum)) {
    body['PageNum'] = request.pageNum;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.projectId)) {
    body['ProjectId'] = request.projectId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetResourcePublicIPs',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询公网ip
 *
 * @param request GetResourcePublicIPsRequest
 * @return GetResourcePublicIPsResponse
 */
async function getResourcePublicIPs(request: GetResourcePublicIPsRequest): GetResourcePublicIPsResponse {
  var runtime = new Util.RuntimeOptions{};
  return getResourcePublicIPsWithOptions(request, runtime);
}

model ListAppRequest {
  keySearch?: string(name='KeySearch', example='example'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
}

model ListAppResponseBody = {
  apps?: [ 
    {
      appId?: string(name='AppId', example='4384****'),
      appName?: string(name='AppName', example='example'),
      appType?: string(name='AppType', example='end_game'),
      gmtCreate?: string(name='GmtCreate', example='2022-04-06 02:00:00'),
      gmtModified?: string(name='GmtModified', example='2022-04-06 02:00:00'),
      versionAdaptNum?: long(name='VersionAdaptNum', example='10'),
      versionTotalNum?: long(name='VersionTotalNum', example='28'),
    }
  ](name='Apps'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
  total?: long(name='Total', example='12'),
}

model ListAppResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAppResponseBody(name='body'),
}

/**
 * @summary 应用列表接口
 *
 * @param request ListAppRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAppResponse
 */
async function listAppWithOptions(request: ListAppRequest, runtime: Util.RuntimeOptions): ListAppResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.keySearch)) {
    body['KeySearch'] = request.keySearch;
  }
  if (!Util.isUnset(request.pageNumber)) {
    body['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListApp',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 应用列表接口
 *
 * @param request ListAppRequest
 * @return ListAppResponse
 */
async function listApp(request: ListAppRequest): ListAppResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAppWithOptions(request, runtime);
}

model ListAppSessionsRequest {
  appId?: string(name='AppId', example='13027XXXX'),
  customSessionIds?: [ string ](name='CustomSessionIds'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  platformSessionIds?: [ string ](name='PlatformSessionIds'),
  projectId?: string(name='ProjectId', example='d9a8****'),
}

model ListAppSessionsResponseBody = {
  appSessions?: [ 
    {
      appId?: string(name='AppId', example='13027XXXX'),
      appVersion?: string(name='AppVersion', example='35067XXXX'),
      bizInfo?: {
        startTime?: string(name='StartTime', description='会话启动时间', example='2022-07-20 17:58:51'),
        stopTime?: string(name='StopTime', description='会话停止时间', example='2022-07-20 17:58:57'),
      }(name='BizInfo', description='业务特定的信息，如会话启动/停止时间。'),
      customSessionId?: string(name='CustomSessionId', example='1ADE0XXXX'),
      platformSessionId?: string(name='PlatformSessionId', example='100XXXX'),
      projectId?: string(name='ProjectId', example='d9a8****'),
      status?: string(name='Status', example='running'),
    }
  ](name='AppSessions'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
  totalCount?: int32(name='TotalCount', example='100'),
}

model ListAppSessionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAppSessionsResponseBody(name='body'),
}

/**
 * @summary 查询App会话
 *
 * @param request ListAppSessionsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAppSessionsResponse
 */
async function listAppSessionsWithOptions(request: ListAppSessionsRequest, runtime: Util.RuntimeOptions): ListAppSessionsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appId)) {
    query['AppId'] = request.appId;
  }
  if (!Util.isUnset(request.customSessionIds)) {
    query['CustomSessionIds'] = request.customSessionIds;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.platformSessionIds)) {
    query['PlatformSessionIds'] = request.platformSessionIds;
  }
  if (!Util.isUnset(request.projectId)) {
    query['ProjectId'] = request.projectId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAppSessions',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询App会话
 *
 * @param request ListAppSessionsRequest
 * @return ListAppSessionsResponse
 */
async function listAppSessions(request: ListAppSessionsRequest): ListAppSessionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAppSessionsWithOptions(request, runtime);
}

model ListAppVersionRequest {
  appId?: string(name='AppId', description='This parameter is required.', example='4384****'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
}

model ListAppVersionResponseBody = {
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
  total?: long(name='Total', example='16'),
  versions?: [ 
    {
      appId?: string(name='AppId', example='4384****'),
      appVersionId?: string(name='AppVersionId', example='1432****'),
      appVersionName?: string(name='AppVersionName', example='exampleVersion'),
      appVersionStatus?: string(name='AppVersionStatus', example='file_uploading'),
      appVersionStatusMemo?: string(name='AppVersionStatusMemo'),
      consumeCu?: double(name='ConsumeCu', example='0.31'),
      fileAddress?: string(name='FileAddress', example='https://www.example.com/exampleFile.tar'),
      fileSize?: long(name='FileSize', example='1024'),
      fileUploadFinishTime?: string(name='FileUploadFinishTime', example='2022-04-06 02:00:00'),
      fileUploadType?: string(name='FileUploadType', example='cloud_file_download'),
      gmtCreate?: string(name='GmtCreate', example='2022-04-06 02:00:00'),
      gmtModified?: string(name='GmtModified', example='2022-04-06 02:00:00'),
    }
  ](name='Versions'),
}

model ListAppVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAppVersionResponseBody(name='body'),
}

/**
 * @summary 应用版本列表接口
 *
 * @param request ListAppVersionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAppVersionResponse
 */
async function listAppVersionWithOptions(request: ListAppVersionRequest, runtime: Util.RuntimeOptions): ListAppVersionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appId)) {
    body['AppId'] = request.appId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    body['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListAppVersion',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 应用版本列表接口
 *
 * @param request ListAppVersionRequest
 * @return ListAppVersionResponse
 */
async function listAppVersion(request: ListAppVersionRequest): ListAppVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAppVersionWithOptions(request, runtime);
}

model ListInstancesRequest {
  districtId?: string(name='DistrictId', example='huadong'),
  instanceId?: [ string ](name='InstanceId'),
  instanceType?: string(name='InstanceType', example='gcs.r1c1m1.1xlarge'),
  maxResults?: int32(name='MaxResults', example='20'),
  nextToken?: string(name='NextToken', example='BEXZPF01W23U46598WVf'),
  projectId?: string(name='ProjectId', example='4820372607851300489003'),
  status?: string(name='Status', example='CREATING'),
}

model ListInstancesResponseBody = {
  instances?: [ 
    {
      creationTime?: string(name='CreationTime', example='2023-12-13T11:12:11Z'),
      districtId?: string(name='DistrictId', example='huadong'),
      instanceId?: string(name='InstanceId', example='gcs-bmt0kbn7e013aedg9'),
      instanceType?: string(name='InstanceType', example='gcs.r1c1m1.1xlarge'),
      projectId?: string(name='ProjectId', example='4820372607851300489003'),
      status?: string(name='Status', example='CREATING'),
    }
  ](name='Instances'),
  maxResults?: string(name='MaxResults', example='50'),
  nextToken?: string(name='NextToken', example='BEXZPF01W23U46598WVf'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
}

model ListInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstancesResponseBody(name='body'),
}

/**
 * @summary 查询GCS实例列表
 *
 * @param request ListInstancesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListInstancesResponse
 */
async function listInstancesWithOptions(request: ListInstancesRequest, runtime: Util.RuntimeOptions): ListInstancesResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstances',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询GCS实例列表
 *
 * @param request ListInstancesRequest
 * @return ListInstancesResponse
 */
async function listInstances(request: ListInstancesRequest): ListInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listInstancesWithOptions(request, runtime);
}

model ModifyAppRequest {
  appId?: string(name='AppId', description='This parameter is required.', example='4384****'),
  appName?: string(name='AppName', description='This parameter is required.', example='example'),
}

model ModifyAppResponseBody = {
  appId?: string(name='AppId', example='4384****'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
}

model ModifyAppResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyAppResponseBody(name='body'),
}

/**
 * @summary 应用修改服务
 *
 * @param request ModifyAppRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyAppResponse
 */
async function modifyAppWithOptions(request: ModifyAppRequest, runtime: Util.RuntimeOptions): ModifyAppResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appId)) {
    body['AppId'] = request.appId;
  }
  if (!Util.isUnset(request.appName)) {
    body['AppName'] = request.appName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ModifyApp',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 应用修改服务
 *
 * @param request ModifyAppRequest
 * @return ModifyAppResponse
 */
async function modifyApp(request: ModifyAppRequest): ModifyAppResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyAppWithOptions(request, runtime);
}

model ModifyAppVersionRequest {
  appVersionId?: string(name='AppVersionId', description='This parameter is required.', example='1432****'),
  appVersionName?: string(name='AppVersionName', description='This parameter is required.', example='exampleVersion'),
}

model ModifyAppVersionResponseBody = {
  appVersionId?: string(name='AppVersionId', example='1432****'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
}

model ModifyAppVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyAppVersionResponseBody(name='body'),
}

/**
 * @summary 应用版本修改服务
 *
 * @param request ModifyAppVersionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyAppVersionResponse
 */
async function modifyAppVersionWithOptions(request: ModifyAppVersionRequest, runtime: Util.RuntimeOptions): ModifyAppVersionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appVersionId)) {
    body['AppVersionId'] = request.appVersionId;
  }
  if (!Util.isUnset(request.appVersionName)) {
    body['AppVersionName'] = request.appVersionName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ModifyAppVersion',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 应用版本修改服务
 *
 * @param request ModifyAppVersionRequest
 * @return ModifyAppVersionResponse
 */
async function modifyAppVersion(request: ModifyAppVersionRequest): ModifyAppVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyAppVersionWithOptions(request, runtime);
}

model ReleaseCapacityRequest {
  appId?: string(name='AppId', description='This parameter is required.', example='13027****'),
  appVersion?: string(name='AppVersion', example='35067****'),
  districtId?: string(name='DistrictId', description='This parameter is required.', example='huadong'),
  expectReleaseSessionCapacity?: int32(name='ExpectReleaseSessionCapacity', description='This parameter is required.', example='100'),
  projectId?: string(name='ProjectId', description='This parameter is required.', example='d9a8****'),
}

model ReleaseCapacityResponseBody = {
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
  taskId?: string(name='TaskId', example='b354****'),
}

model ReleaseCapacityResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ReleaseCapacityResponseBody(name='body'),
}

/**
 * @summary 释放 session 资源预定的资源
 *
 * @param request ReleaseCapacityRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ReleaseCapacityResponse
 */
async function releaseCapacityWithOptions(request: ReleaseCapacityRequest, runtime: Util.RuntimeOptions): ReleaseCapacityResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appId)) {
    body['AppId'] = request.appId;
  }
  if (!Util.isUnset(request.appVersion)) {
    body['AppVersion'] = request.appVersion;
  }
  if (!Util.isUnset(request.districtId)) {
    body['DistrictId'] = request.districtId;
  }
  if (!Util.isUnset(request.expectReleaseSessionCapacity)) {
    body['ExpectReleaseSessionCapacity'] = request.expectReleaseSessionCapacity;
  }
  if (!Util.isUnset(request.projectId)) {
    body['ProjectId'] = request.projectId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ReleaseCapacity',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 释放 session 资源预定的资源
 *
 * @param request ReleaseCapacityRequest
 * @return ReleaseCapacityResponse
 */
async function releaseCapacity(request: ReleaseCapacityRequest): ReleaseCapacityResponse {
  var runtime = new Util.RuntimeOptions{};
  return releaseCapacityWithOptions(request, runtime);
}

model ReleaseCapacityByBatchRequest {
  resBatchId?: string(name='ResBatchId', description='This parameter is required.', example='726573XXXX'),
}

model ReleaseCapacityByBatchResponseBody = {
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
}

model ReleaseCapacityByBatchResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ReleaseCapacityByBatchResponseBody(name='body'),
}

/**
 * @summary 根据资源批次号释放 session 资源预定的资源
 *
 * @param request ReleaseCapacityByBatchRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ReleaseCapacityByBatchResponse
 */
async function releaseCapacityByBatchWithOptions(request: ReleaseCapacityByBatchRequest, runtime: Util.RuntimeOptions): ReleaseCapacityByBatchResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.resBatchId)) {
    body['ResBatchId'] = request.resBatchId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ReleaseCapacityByBatch',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 根据资源批次号释放 session 资源预定的资源
 *
 * @param request ReleaseCapacityByBatchRequest
 * @return ReleaseCapacityByBatchResponse
 */
async function releaseCapacityByBatch(request: ReleaseCapacityByBatchRequest): ReleaseCapacityByBatchResponse {
  var runtime = new Util.RuntimeOptions{};
  return releaseCapacityByBatchWithOptions(request, runtime);
}

model ReleaseInstancesRequest {
  amount?: int32(name='Amount', description='This parameter is required.', example='1'),
  districtId?: string(name='DistrictId', description='This parameter is required.', example='huadong'),
  instanceType?: string(name='InstanceType', description='This parameter is required.', example='gcs.r1c1m1.1xlarge'),
  projectId?: string(name='ProjectId', description='This parameter is required.', example='4820372607851300489003'),
}

model ReleaseInstancesResponseBody = {
  instanceIds?: [ string ](name='InstanceIds'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
}

model ReleaseInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ReleaseInstancesResponseBody(name='body'),
}

/**
 * @summary 退订GCS实例
 *
 * @param request ReleaseInstancesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ReleaseInstancesResponse
 */
async function releaseInstancesWithOptions(request: ReleaseInstancesRequest, runtime: Util.RuntimeOptions): ReleaseInstancesResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.amount)) {
    body['Amount'] = request.amount;
  }
  if (!Util.isUnset(request.districtId)) {
    body['DistrictId'] = request.districtId;
  }
  if (!Util.isUnset(request.instanceType)) {
    body['InstanceType'] = request.instanceType;
  }
  if (!Util.isUnset(request.projectId)) {
    body['ProjectId'] = request.projectId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ReleaseInstances',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 退订GCS实例
 *
 * @param request ReleaseInstancesRequest
 * @return ReleaseInstancesResponse
 */
async function releaseInstances(request: ReleaseInstancesRequest): ReleaseInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  return releaseInstancesWithOptions(request, runtime);
}

model ReserveInstancesRequest {
  amount?: int32(name='Amount', description='This parameter is required.', example='1'),
  districtId?: string(name='DistrictId', description='This parameter is required.', example='huadong'),
  instanceType?: string(name='InstanceType', description='This parameter is required.', example='gcs.r1c1m1.1xlarge'),
  projectId?: string(name='ProjectId', description='This parameter is required.', example='5469588382860444937003'),
}

model ReserveInstancesResponseBody = {
  instanceIds?: [ string ](name='InstanceIds'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
}

model ReserveInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ReserveInstancesResponseBody(name='body'),
}

/**
 * @summary 预定GCS实例
 *
 * @param request ReserveInstancesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ReserveInstancesResponse
 */
async function reserveInstancesWithOptions(request: ReserveInstancesRequest, runtime: Util.RuntimeOptions): ReserveInstancesResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.amount)) {
    body['Amount'] = request.amount;
  }
  if (!Util.isUnset(request.districtId)) {
    body['DistrictId'] = request.districtId;
  }
  if (!Util.isUnset(request.instanceType)) {
    body['InstanceType'] = request.instanceType;
  }
  if (!Util.isUnset(request.projectId)) {
    body['ProjectId'] = request.projectId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ReserveInstances',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 预定GCS实例
 *
 * @param request ReserveInstancesRequest
 * @return ReserveInstancesResponse
 */
async function reserveInstances(request: ReserveInstancesRequest): ReserveInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  return reserveInstancesWithOptions(request, runtime);
}

model SendBizCocChangeCallbackRequest {
  platformSessionId?: string(name='PlatformSessionId'),
  result?: boolean(name='Result'),
}

model SendBizCocChangeCallbackResponseBody = {
  requestId?: string(name='RequestId'),
}

model SendBizCocChangeCallbackResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SendBizCocChangeCallbackResponseBody(name='body'),
}

/**
 * @summary 发送业务能力变更结果回调
 *
 * @param request SendBizCocChangeCallbackRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SendBizCocChangeCallbackResponse
 */
async function sendBizCocChangeCallbackWithOptions(request: SendBizCocChangeCallbackRequest, runtime: Util.RuntimeOptions): SendBizCocChangeCallbackResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.platformSessionId)) {
    query['PlatformSessionId'] = request.platformSessionId;
  }
  if (!Util.isUnset(request.result)) {
    query['Result'] = request.result;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SendBizCocChangeCallback',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 发送业务能力变更结果回调
 *
 * @param request SendBizCocChangeCallbackRequest
 * @return SendBizCocChangeCallbackResponse
 */
async function sendBizCocChangeCallback(request: SendBizCocChangeCallbackRequest): SendBizCocChangeCallbackResponse {
  var runtime = new Util.RuntimeOptions{};
  return sendBizCocChangeCallbackWithOptions(request, runtime);
}

model StopAppSessionRequest {
  customSessionId?: string(name='CustomSessionId', example='1ADE0XXXX'),
  platformSessionId?: string(name='PlatformSessionId', example='100XXXX'),
  stopParam?: [ 
    {
      key?: string(name='Key', description='目前支持的枚举值包括：
- reason：停止原因。', example='reason'),
      value?: any(name='Value', description='key对应的取值。', example='exampleValue'),
    }
  ](name='StopParam', description='停止容器参数。此参数将透传到Agent。'),
}

model StopAppSessionShrinkRequest {
  customSessionId?: string(name='CustomSessionId', example='1ADE0XXXX'),
  platformSessionId?: string(name='PlatformSessionId', example='100XXXX'),
  stopParamShrink?: string(name='StopParam', description='停止容器参数。此参数将透传到Agent。'),
}

model StopAppSessionResponseBody = {
  appId?: string(name='AppId', example='13027XXXX'),
  appVersion?: string(name='AppVersion', example='35067XXXX'),
  customSessionId?: string(name='CustomSessionId', example='1ADE0XXXX'),
  platformSessionId?: string(name='PlatformSessionId', example='100XXXX'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
}

model StopAppSessionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StopAppSessionResponseBody(name='body'),
}

/**
 * @summary 停止App会话
 *
 * @param tmpReq StopAppSessionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return StopAppSessionResponse
 */
async function stopAppSessionWithOptions(tmpReq: StopAppSessionRequest, runtime: Util.RuntimeOptions): StopAppSessionResponse {
  Util.validateModel(tmpReq);
  var request = new StopAppSessionShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.stopParam)) {
    request.stopParamShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.stopParam, 'StopParam', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.customSessionId)) {
    query['CustomSessionId'] = request.customSessionId;
  }
  if (!Util.isUnset(request.platformSessionId)) {
    query['PlatformSessionId'] = request.platformSessionId;
  }
  if (!Util.isUnset(request.stopParamShrink)) {
    query['StopParam'] = request.stopParamShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StopAppSession',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 停止App会话
 *
 * @param request StopAppSessionRequest
 * @return StopAppSessionResponse
 */
async function stopAppSession(request: StopAppSessionRequest): StopAppSessionResponse {
  var runtime = new Util.RuntimeOptions{};
  return stopAppSessionWithOptions(request, runtime);
}

model StopAppSessionBatchRequest {
  appId?: string(name='AppId', example='13027****'),
  appVersion?: string(name='AppVersion', example='35067****'),
  batchId?: string(name='BatchId', description='This parameter is required.', example='6d4d****'),
  projectId?: string(name='ProjectId', example='d9a8****'),
  stopParam?: [ 
    {
      key?: string(name='Key', example='reason'),
      value?: any(name='Value', example='exampleValue'),
    }
  ](name='StopParam'),
  tags?: [ 
    {
      key?: string(name='Key', example='exampleTag'),
      value?: string(name='Value', example='exampleValue'),
    }
  ](name='Tags'),
}

model StopAppSessionBatchShrinkRequest {
  appId?: string(name='AppId', example='13027****'),
  appVersion?: string(name='AppVersion', example='35067****'),
  batchId?: string(name='BatchId', description='This parameter is required.', example='6d4d****'),
  projectId?: string(name='ProjectId', example='d9a8****'),
  stopParamShrink?: string(name='StopParam'),
  tags?: [ 
    {
      key?: string(name='Key', example='exampleTag'),
      value?: string(name='Value', example='exampleValue'),
    }
  ](name='Tags'),
}

model StopAppSessionBatchResponseBody = {
  appId?: string(name='AppId', example='13027****'),
  batchId?: string(name='BatchId', example='6d4d****'),
  projectId?: string(name='ProjectId', example='d9a8****'),
  requestId?: string(name='RequestId', example='46329898-489C-4E63-9BA1-C1DA5C5D0986'),
}

model StopAppSessionBatchResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StopAppSessionBatchResponseBody(name='body'),
}

/**
 * @summary 批量停止会话接口
 *
 * @param tmpReq StopAppSessionBatchRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return StopAppSessionBatchResponse
 */
async function stopAppSessionBatchWithOptions(tmpReq: StopAppSessionBatchRequest, runtime: Util.RuntimeOptions): StopAppSessionBatchResponse {
  Util.validateModel(tmpReq);
  var request = new StopAppSessionBatchShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.stopParam)) {
    request.stopParamShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.stopParam, 'StopParam', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.appId)) {
    query['AppId'] = request.appId;
  }
  if (!Util.isUnset(request.appVersion)) {
    query['AppVersion'] = request.appVersion;
  }
  if (!Util.isUnset(request.batchId)) {
    query['BatchId'] = request.batchId;
  }
  if (!Util.isUnset(request.projectId)) {
    query['ProjectId'] = request.projectId;
  }
  if (!Util.isUnset(request.stopParamShrink)) {
    query['StopParam'] = request.stopParamShrink;
  }
  if (!Util.isUnset(request.tags)) {
    query['Tags'] = request.tags;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StopAppSessionBatch',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 批量停止会话接口
 *
 * @param request StopAppSessionBatchRequest
 * @return StopAppSessionBatchResponse
 */
async function stopAppSessionBatch(request: StopAppSessionBatchRequest): StopAppSessionBatchResponse {
  var runtime = new Util.RuntimeOptions{};
  return stopAppSessionBatchWithOptions(request, runtime);
}

model UpdateSessionBizStatusRequest {
  bizStatus?: string(name='BizStatus'),
  platformSessionId?: string(name='PlatformSessionId', description='This parameter is required.'),
}

model UpdateSessionBizStatusResponseBody = {
  code?: string(name='Code'),
  data?: {
    customSessionId?: string(name='CustomSessionId'),
    platformSessionId?: string(name='PlatformSessionId'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateSessionBizStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateSessionBizStatusResponseBody(name='body'),
}

/**
 * @summary 更新会话状态
 *
 * @param request UpdateSessionBizStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateSessionBizStatusResponse
 */
async function updateSessionBizStatusWithOptions(request: UpdateSessionBizStatusRequest, runtime: Util.RuntimeOptions): UpdateSessionBizStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.bizStatus)) {
    query['BizStatus'] = request.bizStatus;
  }
  if (!Util.isUnset(request.platformSessionId)) {
    query['PlatformSessionId'] = request.platformSessionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateSessionBizStatus',
    version = '2021-11-11',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 更新会话状态
 *
 * @param request UpdateSessionBizStatusRequest
 * @return UpdateSessionBizStatusResponse
 */
async function updateSessionBizStatus(request: UpdateSessionBizStatusRequest): UpdateSessionBizStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateSessionBizStatusWithOptions(request, runtime);
}

